package World.Module.IdGenerator;

public class InstanceIdStruct {

    public int Time;  // 32bit
    public int Value; // 32bit

    public long ToLong()
    {
        long result = 0;
        result |= this.Time;
        result <<= 32;
        result |= this.Value;
        return result;
    }

    public InstanceIdStruct(int time, int value)
    {
        this.Time = time;
        this.Value = value;
    }

    public InstanceIdStruct(long id)
    {
        long result = id;
        this.Value = (int)(result & Integer.MAX_VALUE);
        result >>= 32;
        this.Time = (int)(result & Integer.MAX_VALUE);
    }

}
